<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head th:fragment="header">
    <meta charset="UTF-8">
    <title>威客任务平台</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark" th:fragment="header">
        <div class="container">
            <a class="navbar-brand" href="/">威客任务平台</a>
            <div class="navbar-nav ms-auto" sec:authorize="isAuthenticated()">
                <span class="navbar-text me-3" sec:authentication="name"></span>
                <a class="nav-link" th:href="@{/profile}">个人资料</a>
                <form th:action="@{/logout}" method="post" class="d-inline-block">
                    <button type="submit" class="nav-link btn btn-link">退出</button>
                </form>
            </div>
            <div class="navbar-nav ms-auto" sec:authorize="!isAuthenticated()">
                <a class="nav-link" th:href="@{/login}">登录</a>
                <a class="nav-link" th:href="@{/register}">注册</a>
            </div>
        </div>
    </nav>
</body>
</html>